package com.kb.erp.excel;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
@EqualsAndHashCode
@TableName("erp")
public class PcbaData {

    @TableId(value = "id",type = IdType.AUTO)
    private Long id;
    @ExcelProperty("批次号")
    @ColumnWidth(20)
    @TableField("批次号")
    private String orderNo;

    @ExcelProperty("状态")
    @TableField("状态")
    private String Status;

    @ColumnWidth(15)
    @ExcelProperty("合同编号")
    @TableField("合同编号")
    private String contractNo;

    @ColumnWidth(30)
    @ExcelProperty("项目名称")
    @TableField("项目名称")
    private String fileName;

    @ExcelProperty("客户代码")
    @TableField("客户代码")
    private String customerCode;

    @ColumnWidth(30)
    @ExcelProperty("客户名称")
    @TableField("客户名称")
    private String customerName;

    @ExcelProperty("业务员")
    @TableField("业务员")
    private String salesName;

    @ExcelProperty("业务部门")
    @ColumnWidth(15)
    @TableField("业务部门")
    private String businessDepartment;

    @ExcelProperty("客户联系人")
    @TableField("客户联系人")
    private String customerContact;

    @ExcelProperty("联系电话")
    @TableField("联系电话")
    private String customerPhone;

    @ExcelProperty("联系邮件")
    @TableField("联系邮件")
    private String customerEmail;

    @ExcelProperty("客户类型")
    @TableField("客户类型")
    private String customerProfession;

    @ExcelProperty("Set数")
    @TableField("Set数")
    private String setQuantity;

    @ExcelProperty("单价")
    @TableField("单价")
    private String unitPrice;

    @ExcelProperty("订单金额")
    @TableField("订单金额")
    private String totalAmount;

    @ExcelProperty("订单日期")
    @ColumnWidth(25)
    @TableField("订单日期")
    private Date orderDate;

    @ExcelProperty("订单交期")
    @ColumnWidth(25)
    @TableField("订单交期")
    private Date deliveryDate;

    @ExcelProperty("税票类型")
    @TableField("税票类型")
    private String invTYPE;

    @ExcelProperty("产能组织")
    @TableField("产能组织")
    private String prodOrg;

    @ExcelProperty("贸易路径")
    @TableField("贸易路径")
    private String tradeDesc;

    @ExcelProperty("销售组织")
    @TableField("销售组织")
    private String salesOrganization;

    @ExcelProperty("生产组织")
    @TableField("生产组织")
    private String productionOrganization;

    @ExcelProperty("币种")
    @TableField("币种")
    private String currencyCode;

    @ExcelProperty("备注")
    @ColumnWidth(70)
    @TableField("备注")
    private String remark;

    public void trimFields() {
        // 去除空格
        this.prodOrg = this.prodOrg != null ? this.prodOrg.trim() : null;
        this.invTYPE = this.invTYPE != null ? this.invTYPE.trim() : null;
        this.orderNo = this.orderNo != null ? this.orderNo.trim() : null;
        this.contractNo = this.contractNo != null ? this.contractNo.trim() : null;
        this.fileName = this.fileName != null ? this.fileName.trim() : null;
        this.customerCode = this.customerCode != null ? this.customerCode.trim() : null;
        this.customerName = this.customerName != null ? this.customerName.trim() : null;
        this.salesName = this.salesName != null ? this.salesName.trim() : null;
        this.businessDepartment = this.businessDepartment != null ? this.businessDepartment.trim() : null;
        this.customerContact = this.customerContact != null ? this.customerContact.trim() : null;
        this.customerPhone = this.customerPhone != null ? this.customerPhone.trim() : null;
        this.customerEmail = this.customerEmail != null ? this.customerEmail.trim() : null;
        this.customerProfession = this.customerProfession != null ? this.customerProfession.trim() : null;


        this.setQuantity = this.setQuantity != null ? this.setQuantity.trim() : null;
        this.totalAmount = this.totalAmount != null ? this.totalAmount.trim() : null;
        this.unitPrice = this.unitPrice != null ? this.unitPrice.trim() : null;
        this.remark = this.remark != null ? this.remark.trim() : null;
        this.tradeDesc = this.tradeDesc != null ? this.tradeDesc.trim() : null;
        this.salesOrganization = this.salesOrganization != null ? this.salesOrganization.trim() : null;
        this.productionOrganization = this.productionOrganization != null ? this.productionOrganization.trim() : null;

    }
}
